<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button>按钮</button>
    <div></div>
    <script>
        var btn = document.querySelector('button')
        var div = document.querySelector('div')
       
        btn.addEventListener('click', function () {
            location.href = "https://www.baidu.com/?tn=88093251_102_hao_pg"
        })
    //  五秒之后跳转新界面
        var timer = 5
        divs()//先调用一次函数就不会延时留白
        setInterval(divs, 1000)
        function divs() {
            if (timer == 0) {
                location.href = "https://www.baidu.com/?tn=88093251_102_hao_pg"
            } else {
                div.innerHTML = '' + timer + '秒之后跳转新链接'
                timer--
            }

        }









    </script>
</body>

</html>